const express = require('express')
const { Router } = require('express')

//导入处理路径的核心模快
const path = require('path')

//导入解formdata格式表单数据包
const multer = require('multer')
const expressJoi=require('@escook/express-joi')
//导入文章路由处理函数
const article_handler = require('../router_handler/article')

//导入文章的验证模快
const {add_article_schema}=require('../schema/article')

//创建multer的实例对象，通过dest属性 指定文件的存放路径
const upload = multer({ dest: path.join(__dirname, '../uploads') })

const router = express.Router()
// 发布新文章
router.post('/add', upload.single('cover_img'), article_handler.addArticle)


module.exports = router
